[BugFix]fix Qwen3 MoE call gate twice#40664
Merged
robertgshaw2-redhat merged 1 commit intovllm-project:mainfrom Apr 23, 2026
Merged
[BugFix]fix Qwen3 MoE call gate twice#40664robertgshaw2-redhat merged 1 commit intovllm-project:mainfrom
robertgshaw2-redhat merged 1 commit intovllm-project:mainfrom
Conversation
Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
robertgshaw2-redhat
approved these changes
Apr 23, 2026
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the forward method in vllm/model_executor/models/qwen3_moe.py to support internal routing within the FusedMoE class. It introduces a conditional check to determine whether to use an internal router or an external gate for computing router logits, providing flexibility for different MoE implementations. I have no feedback to provide as there were no review comments.
xinyu-intel
approved these changes
Apr 23, 2026
bnellnm
approved these changes
Apr 23, 2026
avinashsingh77
pushed a commit
to avinashsingh77/vllm
that referenced
this pull request
Apr 27, 2026
Signed-off-by: Kunshang Ji <kunshang.ji@intel.com> Signed-off-by: Avinash Singh <avinashsingh.rcoem@gmail.com>
Lafunamor
pushed a commit
to Lafunamor/vllm
that referenced
this pull request
May 1, 2026
Signed-off-by: Kunshang Ji <kunshang.ji@intel.com> Signed-off-by: Adrian <info@zzit.ch>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Qwen3 MoE model will call gate gemm twice, we find this in xpu kernel profiling. thanks @zufangzhu raise this.
see discussion here #35326 (comment)
This PR just follow deepseek_v2.py and other modeling file use
is_internal_routerMoreover, there may be some dead code, will address in follow up PRs.
cc @robertgshaw2-redhat @bnellnm
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.